<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户关系管理及报关单统计系统</title>
<!--#include file="lib/plugins.asp"-->
<!--#include file="lib/css-common-lib.asp"-->
<style type="text/css">
	.ui-datepicker table {
		border: 0;
	}
	.ui-autocomplete-loading { 
		background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; 
	}
	.ui-autocomplete,.ui-menu-item .ui-corner-all {
			border-radius: 0;
	}
	thead th{
		text-align:center;
		background:#e0e0e0;
	}
	tbody th[scope="row"],tbody th.sub{
		text-align:center;
	}
	input,select{
		border:1px solid #888888;
	}
	input:hover,input:active,select:hover,select:active{
		border:1px solid #aa6666
	}
	input[type=text]{
		padding:2px;
		margin:1px 0;
	}
	#pagebar{
		float:right;
	}
	#search_bar{
		border-width:1px 0;
	}
	#search_bar td{
		padding:1px;
		border-width:0;
	}
	#search_bar tr:hover td{
		background:#fff;
	}
	.bt_button{
    cursor: pointer;
    overflow: visible;
    width: auto;
    background: url("lib/yaml/screen/images/button_gray.png") repeat-x scroll left top #454545;
    border-color: #DDDDDD #444444 #444444 #DDDDDD;
    border-style: solid;
    border-width: 1px;
    color: #000000;
    padding: 5px 1em;	
	}
	.bt_button:hover,.bt_button:active,.bt_button:focus{
    background: none repeat-x scroll left top #555555;
    border-color: #444444 #DDDDDD #DDDDDD #444444;
    color: #ffffff;
	}
	#page_go,#print_search,.bt_act{
		padding:0;
	}
	.chk{
		background-color:#d0d0d0;
	}
	#diaglog_print{
		display:none;
	}
	#lb_search{
		width:5em;
	}
	#bts_search{
		width:9.9em;
		text-align:right;
	}
	#adv_search{
		display:none;
	}
	.err{
		transition: all 0.40s ease-in-out;
		-webkit-transition: all 0.40s ease-in-out;
		-moz-transition: all 0.40s ease-in-out;
		border: #aa0000 1px solid;
		outline: none;
		box-shadow: 0 0 5px rgba(99, 0, 0, 1);
		-webkit-box-shadow: 0 0 5px rgba(99, 0, 0, 1);
		-moz-box-shadow: 0 0 5px rgba(99, 0, 0, 1);	
	}
	.cdtr:hover td,th{
		background-color:white;
	}
	.cdtd{
		padding:0;
	}
	.cdtr .cdtd table{
		margin:0;
	}
	.tac{
		text-align:center;
	}
</style>
<script type="text/javascript">
	$(function() {
	
		var cache_country = {},cache_company={},lastXhr_country,lastXhr_company;
		$( "#country" ).autocomplete({
			minLength: 1,
///*			
			select: function( event, ui ) {
				if( ui.item ){
					 $("#countryid").val(ui.item.id); 
				}
			},
//*/
///*			
			change: function( event, ui ) {
				$("#country").removeClass('err');
				if( !ui.item ){
					$("#countryid").val(""); 
					if($("#country").val()!=""){
						$("#country").addClass('err');
					}
				}
			},
//*/
			source: function( request, response ) {
				var term = request.term;
				if ( term in cache_country ) {
					response( cache_country[ term ] );
					return;
				}

				lastXhr_country = $.getJSON( "json_country.asp", request, function( data, status, xhr ) {
					cache_country[ term ] = data;
					if ( xhr === lastXhr_country ) {
						response( data );
					}
				});
			}
		});
		$( "#company" ).autocomplete({
			minLength: 2,
///*			
			select: function( event, ui ) {
				if( ui.item ){
					$("#companyid").val(ui.item.id); 
				}
			},
//*/
///*			
			change: function( event, ui ) {
				$("#company").removeClass('err');
				if( !ui.item ){
					$("#companyid").val(""); 
					if($("#company").val()!=""){
						$("#company").addClass('err');
					}
				}
			},
//*/
			source: function( request, response ) {
				var term = request.term;
				if ( term in cache_company ) {
					response( cache_company[ term ] );
					return;
				}

				lastXhr_company = $.getJSON( "json_company.asp", request, function( data, status, xhr ) {
					cache_company[ term ] = data;
					if ( xhr === lastXhr_company ) {
						response( data );
					}
				});
			}
		});

		$.ajaxSetup ({
			cache: false, //关闭AJAX相应的缓存
			beforeSend:function() {
				$("#search_bar .ui-widget").addClass( "ui-autocomplete-loading" );
			},
			complete:function() {
				$("#search_bar .ui-widget").removeClass( "ui-autocomplete-loading" );
			}
		});


		var p=1;
		function vi(p){
			var start_time = new Date().getTime();
			$.get("rpt_main.asp?page="+p+"&"+$("#fm_search").serialize(),function(data){	//用ajax的get方式提交
				$("#rpt_main").html(data);
			});
			var end_time = new Date().getTime();
			$("#show_runtime").html(end_time-start_time);
		}
		$("#bt_search").click(function(){
			vi(p);
		});
		
		$("#pagebar a").live('click',function(e){	//对分页栏中的a元素进行操作
			e.preventDefault();	//阻止a的原先事件
			vi($(this).attr("id"));	//根据获取的页码值调用显示页面函数
		});
		$("#page_go").live('click',function(e){	//对分页栏中的input元素进行操作
			e.preventDefault();
			if (isNaN($("#page_val").val())||$.trim($("#page_val").val())==""){	//判断输入的是否是数字
				alert("输入的页码错误，请输入正确页码！");
				$("#page_val").select();
				return false;	//页码值不是数字则退出；
			}
			vi($("#page_val").val());
		});
		
		$("#rpt_main a.tbl_countryid,a.tbl_companyid").live('click',function(e){	//对分页栏中的a元素进行操作
			e.preventDefault();	//阻止a的原先事件
			filterid=$(this).attr('href');
			filter=$(this).html();
			if(filterid.length==3){
				$("#countryid").val(filterid);
				$("#country").val(filter);
			}else if(filterid.length==10){
				$("#companyid").val(filterid);
				$("#company").val(filter);
			}
			vi(1);
		});
		
		$("#rpt_main a.tbl_cd").live('click',function(e){	//对分页栏中的a元素进行操作
			e.preventDefault();	//阻止a的原先事件
			$tr=$(this).parent().parent();
			tdnum=$tr.find('td,th').length;
			s=$(this).attr('show');
			if(s=='hidden'){
				$tr.next().show();
				$(this).attr('show','true');
			}
			if(s=='true'){
				$tr.next().hide();
				$(this).attr('show','hidden');
			}else if(s=='false'){
				$.get("cd_main.asp?"+$(this).attr('href'),function(data){	//用ajax的get方式提交
					$tr.after("<tr class='cdtr'><td colspan='"+tdnum+"' class='cdtd'>"+data+"</td></tr>");
				});
				$(this).attr('show','true');
			}
		});
	});
</script>
<!--#include file="lib/js-google-analytics.asp"-->
</head>
<%
if not CheckPostFlag(session("aaPostFlag"),0,15) then call JumpErrorPage(2)
%>
<body>
<!--#include file="lib/header.asp"-->
<!--#include file="lib/nav.asp"-->
<div id="main">
<!--#include file="lib/col1.asp"-->
<!--#include file="lib/col2.asp"-->
	<div id="col3" role="main">
		<div id="col3_content" class="clearfix">
			<form id="fm_search" name="fm_search">
				<table id="search_bar" class="full">
					<tr>
						<td>
							<div class="ui-widget">
								<select id="ymid" name="ymid">
									<option value="">选择报表</option>
									<%
										Set rs_ym = Server.CreateObject("ADODB.Recordset")
										sql = "SELECT id FROM ym order by id desc"
										rs_ym.Open sql,conn,1,1
										do while not rs_ym.eof
									%>
									<option value="<%=rs_ym("id")%>"><%=rs_ym("id")%></option>
									<%
											rs_ym.movenext
										loop
										rs_ym.close
										set rs_ym=nothing
									%>
								</select>
								<label for="country">国家：</label>
								<input id="country" type="text" />
								<input id="countryid" name="countryid" type="text" size="3" maxlength="3" readonly="readonly" />
								<label for="company">企业：</label>
								<input id="company" type="text" size="30" />
								<input id="companyid" name="companyid" type="text" size="10" maxlength="10" readonly="readonly" />
							</div>
						</td>
						<td id="bts_search">
							<input id="bt_search" class="bt_button" name="bt_submit" type="button" value="搜索" />
							<input class="bt_button" type="reset" value="重置" />
						</td>
					</tr>
				</table>
			</form>
			<div id="rpt_main"></div>
		</div>
	</div>
</div>
<!--#include file="lib/footer.asp"-->
</body>
</html>
<!--#include file="lib/connclose.asp"-->

